package de.s9mtdev.lol_destiny_home;


import java.util.Random;

public class Utils {
	
	final static String updateURL = "http://s9mtdev.de/files/public-docs/update.dy";

	public static String generateRnd(int length) {
		Random rnd = new Random();
		String allowedChars = "0123456789abcdefghijklmnopqrstuvwxyz";
		int max = allowedChars.length();
		StringBuffer buffer = new StringBuffer();
		for (int i = 0; i < length; i++) {
			int value = rnd.nextInt(max);
			buffer.append(allowedChars.charAt(value));
		}
		return buffer.toString();
	}
	
	public static String lookUpServer() {
		String result = "irc.freenode.net";
//		URL textUrl;
//		  try {
//		   textUrl = new URL(updateURL);
//		   BufferedReader bufferReader = new BufferedReader(new InputStreamReader(textUrl.openStream()));
//		   String StringBuffer;
//		         String stringText = "";
//		   while ((StringBuffer = bufferReader.readLine()) != null) {
//		    stringText += StringBuffer;
//		   }
//		         bufferReader.close();
//		         result = stringText;
//		  } catch (MalformedURLException e) {
//		   e.printStackTrace();
//		  } catch (IOException e) {
//		   e.printStackTrace();
//		  }	
		  return result;
	}
}

